package com.youhome.common.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * Created by chen365 on 2017/10/18.
 */
@Data
@ApiModel
public class Result<T> {

    @ApiModelProperty(value = "状态", position = 0, required = true)
    private Integer status;

    @ApiModelProperty(value = "提示信息", position = 1)
    private String msg;

    @ApiModelProperty(value = "数据", position = 2)
    private T data;

    public Result() {
    }

    public Result(Integer status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public Result(Integer status, String msg, T data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public Result(ResultCode resultCode, T data) {
        this.status = resultCode.getStatus();
        this.msg = resultCode.getMsg();
        this.data = data;
    }

    public Result(ResultCode resultCode) {
        this.status = resultCode.getStatus();
        this.msg = resultCode.getMsg();
    }
}
